<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>

<body>
    <div id="app">

        <textarea name="" id="" cols="30" rows="10" v-model="content" @keydown.enter.prevent="send"></textarea>
        <h2>留言内容</h2>
        <ul>
            <li v-for="item in msg">{{item}}</li>
        </ul>
    </div>
    <script>
        const app = new Vue({
            el: "#app",
            data: {
                content: "",
                msg: [],
            },
            methods: {
                send() {
                    this.msg.push(this.content)
                    this.content = ""
                }
            }
        })
    </script>
</body>

</html>